package com.zhengke.service.bbfx;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zhengke.common.dao.CommonDao;
import com.zhengke.common.object.Result;
import com.zhengke.pojo.GoodsSortAnaly;

@Service
public class SortSalesServiceImpl implements SortSalesService {
	@Autowired
    private CommonDao dao;
	@Override
	
	@SuppressWarnings("unchecked")
	public Result querySortSaleRank(String areaName, String startDate, String endDate, int start, int size)
			throws Exception {
		 Map<String, String> param = new HashMap<String, String>();
			 param.put("areaName", areaName);
		     param.put("startDate", startDate);
		     param.put("endDate", endDate);
		     PageHelper.startPage(start, size, true);
		  List<GoodsSortAnaly> rtnList = (List<GoodsSortAnaly>) dao.findForList("sortSalesMapper.querySortSaleRank", param);
		  PageInfo<GoodsSortAnaly> pageInfo = new PageInfo<GoodsSortAnaly>(rtnList);

	        Result rs = new Result();
	        rs.setCode("0");
	        rs.setCount(pageInfo.getTotal());
	        rs.setData(rtnList);
	        return rs;
	}

}
